//
// Created by Administrator on 2023/8/4.
//
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class Solution {
public:
    vector<string> splitWordsBySeparator(vector<string> &words, char separator) {
        vector<string> ans;
        for (string &word: words) {
            string temp = "";
            for (char x: word) {
                if (x != separator) {
                    temp += x;
                } else {
                    if (temp != "") {
                        ans.push_back(temp);
                        temp = "";
                    }
                }
            }
            if (temp != "")
                ans.push_back(temp);
        }
        return ans;
    }
};

int main() {
    Solution s;
    vector<string> words{"one.two.three", "four.five", "six"};
    vector<string> words2{"$easy$", "$problem$"};
//    vector<string> ans = s.splitWordsBySeparator(words, '.');
    vector<string> ans = s.splitWordsBySeparator(words2, '$');
    for (auto &x: ans) {
        cout << x << endl;
    }
    return 0;
}